/****************************************************
 * 创建人:   robin
 * 创建时间: 2023/9/1.001 11:29
 * 项目名称: cpy
 * 文件名称: GetPsdpTokenCallable.java
 * 文件描述: 
 *
 * All rights Reserved, Designed By 德品软件
 * @Copyright:2023-2023
 *
 ********************************************************/
package com.dp.threadmanager;

import com.dp.constant.CollectConstant;
import com.dp.service.HandleMessageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.Callable;

/**
 * 包名称：com.dp.threadmanager
 * 类名称：GetPsdpTokenCallable
 * 类描述：
 * 创建人： robin
 * 创建时间：2023/9/1.001 11:29
 */
@Slf4j
@Configuration
public class GetPsdpTokenCallable implements Callable<Void> {
    
    private HandleMessageService handleMessageService;
    
    public GetPsdpTokenCallable(HandleMessageService handleMessageService) {
        this.handleMessageService = handleMessageService;
    }
    
    @Override
    public Void call() throws Exception {
        log.info("GetPsdpTokenCallable start");
        
        try {
            while (true) {
                handleMessageService.handlePsdpToken();
                Thread.sleep(CollectConstant.SECOND_600);
            }
        } catch (Exception e) {
            log.error("GetPsdpTokenCallable Exception:", e);
        }
        
        log.info("GetPsdpTokenCallable end");
        return null;
    }
    
}
